#-*- coding: utf-8 -*-
import pygame, cPickle
import funcs, strings

class camera():
    def __init__(self):
        self.x = 0
        self.y = 0
        
    def update(self, do):
        self.do = do
        if self.do == "n" and self.y >= 15:
            self.y -= 15
        if self.do == "s":
            self.y += 15
        if self.do == "e":
            self.x += 15
        if self.do == "w" and self.x >= 15:
            self.x -= 15

class terrain():
    def __init__(self):
        self.map = cPickle.load(open('map.dst'))

        self.ym = 0
        for yy in self.map[0]:
            self.ym+=1
            self.xm=0
            for xx in yy:
                self.xm += 1
        self.xm *= 128
        self.ym *= 128
        
    def draw(self, dest, xc=0, yc=0):
        dest.fill((0,0,0))
        y = 0
        for rows in self.map[0]:
            x = 0
            for cols in rows:
                if not cols == self.map[1]:
                    dest.blit(funcs.img(self.map[1]), (x*128-xc,y*128-yc))
                dest.blit(funcs.img(cols), (x*128-xc,y*128-yc))
                x += 1
            y += 1

#this is VERY importantant func for for control construction menu. 
def constr(stage):
    if stage == 0:
        return strings.pstage0
    if stage == 1:
        return strings.pstage1
    if stage == 2:
        return strings.pstage2
